<?php 
namespace Chat\Model\Entity\Mapper;

use Chat\Model\Entity\ChatMessage as ChatMessageEntity;
use Zend\Stdlib\Hydrator\HydratorInterface;
use Zend\Db\TableGateway\TableGateway;
use Zend\Db\TableGateway\RowGatewayFeature;
use Zend\Db\Sql\Sql;
use Zend\Db\Sql\Insert;

class ChatMessageMapper extends TableGateway
{
	protected $tableName = "Chat";
	
	protected $IDCol = "ID";
	
	protected $senderIDCol = "senderID";
	
	protected $receiverIDCol = "receiverID";
	
	protected  $textCol = "text";
	
	protected $entityPrototype = null;
	
	protected $hydrator = null;
	
	protected $userID = null;
	
	public function __construct(Zend\Db\Adapter\Adapter $adapter){
		parent::__construct ($this->tableName,$adapter, new RowGatewayFeature($this->IDCol));
		
		
		$this->entityPrototype = new ChatMessageEntity();
		$this->hydrator = new \Zend\Stdlib\Hydrator\Reflection;
		
	}
	
	public function insert($entity){
		return parent::insert($this->hydrator->extract($entity));
	}
	
	public function showAllMessage()
	{
// 		$sql = new \Zend\Db\Sql\Sql($this->getAdapter());
// 		$select = $sql->select()
// 			->from($this->tableName)
// 			->where
	}
}

?>